package com.ksyzt.ksite2.server.common;

import java.sql.SQLException;

import com.ksyzt.gwt.server.common.Util;
import com.ksyzt.ksite2.server.database.dao.ILOGDAO;
import com.ksyzt.ksite2.server.database.dao.impl.LOGDAOImpl;
import com.ksyzt.ksite2.shared.modle.LOGObj;

public class Logger {

	public final static int LEVEL_INFO = 0;
	public final static int LEVEL_ERROR = 1;
	public final static int LEVEL_UNKNOWN = 2;

	public static void Loger(int level, String author, String info) {
		ILOGDAO dao = new LOGDAOImpl(Application.getConnection());
		LOGObj log = new LOGObj();
		log.setADDTIME(Util.getCurrentSQLTimestamp());
		log.setAUTHOR(author);
		log.setINFO(info);
		log.setLEVEL(level);
		try {
			dao.insertObject(log);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
